<template>
	<view>
		<tt-bar title="充值" leftIcon="icon-back">
			<template v-slot:rightCnt>
				<text class="flectHistory" @tap="toPage" data-url="rechargeList">充值记录</text>
			</template>
		</tt-bar>
		<view class="reflectBox">
			<text class="reflectTishi">充值金额</text>
			<view class="reflectCnt">
				<view class="reflectInput">
					<text class="moneyMark">￥</text>
					<input type="digit" placeholder="输入充值金额" />
				</view>

				<text class="reflectCount">当前店铺总金额 {{assetInfo.total?assetInfo.total:0}} 元</text>
			</view>
			<button @tap="toPage" data-url="rechargePay">确认充值</button>
		</view>
	</view>
</template>

<script>
	import ttBar from "@/components/ttBar/ttBar.vue";
	import API from "@/common/api.js";
	import {mapState} from "vuex";
	export default {
		components: {
			ttBar
		},
		computed:{
			...mapState({
				userInfo:state=>state.user.userInfo,
				selectShop:state=>state.shop.selectShop,
				
			})
			
		},
		data(){
			return {
				assetInfo:{
					total:0
				}
			}
		},
		methods:{
			getData(){
				API.getAssetInfoBySid(this.selectShop.id).then(res=>{
					if(res.data.code==1){
						this.assetInfo=res.data.data
						
					}else{
						// uni.showToast({
						// 	title: '当前账户没有绑定银行卡，暂无法体现',
						// 	icon: 'none'
						// });
					}
					
				})
			},
		},
		onLoad() {
			this.getData()
			uni.$on("upData",()=>{
				this.getData();
			})
		},
		onPullDownRefresh() {
			setTimeout(() => {
				this.getData();
				uni.stopPullDownRefresh();
			}, 1500)
		}
	}
</script>

<style lang="less">
	page {
		background-color: #f6f6f6;
	}
	.flectHistory {
		font-size: 26rpx;
		color: #8483a4;
	}
	.reflectBox {
		padding: 50upx 54upx;
		display: flex;
		flex-direction: column;

		.reflectTishi {
			font-size: 28rpx;
			font-weight: bold;
			color: #222433;
		}

		.reflectCnt {
			display: flex;
			flex-direction: column;
			background-color: #FFFFFF;
			border-radius: 14rpx;
			padding: 50upx 44upx;
			margin-top: 24upx;

			.reflectInput {
				display: flex;
				align-items: center;
				border-bottom: 3upx solid #f2f2f2;
				padding-bottom: 20upx;

				.moneyMark {
					font-size: 56rpx;
					font-weight: bold;
					color: #222433;
				}

				input {
					font-size: 82rpx;
					font-weight: bold;
					color: #222433;
					flex-grow: 1;
				}
			}

			.reflectCount {
				margin-top: 24upx;
				font-size: 28rpx;
				font-weight: bold;
				color: #a0a0a0;

			}
		}

		button {
			width: 100%;
			height: 98upx;
			background-color: #ffb11a;
			border-radius: 14rpx;
			color: #FFFFFF;
			font-size: 42rpx;
			margin-top: 120upx;
			border: none;
			line-height: 98upx;
		}
		button:after{
			border: none;
		}
	}
</style>
